@extends('layouts.master3')
@section("title")
编辑答案
@endsection
@section("edstyle")
    <link rel="stylesheet" href="/css/edit/style.css">
    <link rel="stylesheet" href="/css/edit/editormd.css">
@endsection
@section("css")
<link href="/css/discuss.css" rel="stylesheet">
@endsection

@section("content")
<div class="contain">
    <form method="POST" action="" accept-charset="UTF-8"><input name="_token" type="hidden" value="WT6bRTGasvg1lAFhl9jXdLYUsGNQVaRdwlYMWvaX">

        <div class="qz-q-editor">
{{$dis->title}}
        </div>

<?php
use App\Utils;
?>
        <div id="test-editormd">
		<textarea name="text" style="display:none;" id="textarea"><?php echo $com->comment;?></textarea>
<input name="_token" id="_token" type="hidden" value="{{csrf_token()}}">
        </div>
        <input name="id" type="hidden" value="{{Utils::id2url($com->id)}}" id="id">
		<input name="text_html" type="hidden" value="" id="text_html">
        <input class="btn btn-primary pull-right" type="submit" value="提交编辑">
    </form>
</div>
@endsection

@section('js')
<script src="http://www.qlcoder.com/js/jquery.min.js"></script>
<script src="http://www.qlcoder.com/js/editormd.js?v=1.0"></script>
<script>
    $(function() {

    })
</script>
<script type="text/javascript">
    var testEditor;
    $(function() {
        editormd.methodOne = function() {
        };

        testEditor = editormd("test-editormd", {
            width  : "100%",
            height : 600,
            path   : 'http://www.qlcoder.com/lib/',
            toolbarAutoFixed:false,
            onload : function() {
            }
        });

        editormd.methodOne();
    });
	$(".btn").click(function(e){
		e.preventDefault();
		if($("#textarea").val()!==""){
			$("#text_html").val($(".markdown-body.editormd-preview-container").html());
			$("form").submit();
					
		}else{return !1;}
	})
    var textAreas = document.getElementById('textarea');

    Array.prototype.forEach.call(textAreas, function(elem) {
        elem.placeholder = elem.placeholder.replace(/\\n/g, '\n');
    });
    if(document.getElementsByClassName("contain")[0]!=null)
        document.getElementsByClassName("contain")[0].style.minHeight=window.innerHeight-152+"px";
</script>
@endsection
